import React from 'react';
import {connect} from 'dva-react-router-3';
import {Link} from 'dva-react-router-3/router';
import styles from './About.less';

function About({dispatch, user}) {
    function getData() {
        dispatch({
            type: 'user/fetchList',
        });

    }

    return (
        <div>
            <h1 onClick={() => getData()}>About<span>test</span></h1>
            <Link to="/">Go to /App</Link>
            <h2 className={styles.title}>User</h2>
            {
                user.map(({id, name}) => <div key={id}>- {name}</div>)
            }
        </div>
    );
}

function mapStateToProps(state) {
    return {
        user: state.user,
    };
}

export default connect(mapStateToProps)(About);
